<!--
 * @Description: 请输入描述信息

 * @Version: 请输入版本号
 * @Autor: xuebao
 * @Date: 2021-12-01 20:06:30
 * @LastEditors: xuebao
 * @LastEditTime: 2021-12-02 18:30:09
-->
<template>
    <div>
        <el-form :model='ruleForm' :rules='rules' ref="refForm">
            <el-form-item prop='username'>
                <el-input placeholder="请输入用户名" v-model="ruleForm.username">
                    <i slot="prefix" class="el-icon-user"></i>
                </el-input>
            </el-form-item>
            <el-form-item prop='password'>
                <el-input placeholder="请输入密码" show-password v-model="ruleForm.password">
                    <i slot="prefix" class="el-icon-lock"></i>
                </el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" style="width:100%" @click="login">登陆</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
export default {
    name: "AccountLogin",
    props: {
        ruleForm: {
            type: Object,
            required: true,
        },
        rules: {
            type: Object,
            required: true,
        },
    },
    methods: {
        login() {
          console.log(this.$refs);
            this.$refs.refForm.validate((valid) => {
              console.log(valid);
                if (valid) {
                    this.$emit('submit');
                } else {
                    this.$emit("errHandle");
                }
            });
        },
    },
};
</script>

<style></style>
